package com.voicechat.firstmet.activity;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.voicechat.firstmet.MainActivity;
import com.voicechat.firstmet.R;
import com.voicechat.firstmet.base.BaseActivity;
import com.voicechat.firstmet.utils.StatusBarUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ProjectName: FirstMet
 * @Package: com.voicechat.firstmet.activity_imessage
 * @ClassName: AllSuccessActivity
 * @Description: 各种成功页面(0投诉 、 1举报 、2充值 、 3提现 ， 4购买 、 5客服与帮助)
 * @Author: ljp
 * @CreateDate: 2018/10/15 16:59
 * @Version: 1.0
 */
public class AllSuccessActivity extends BaseActivity {
    @BindView(R.id.linear_back)
    LinearLayout linearBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.image_success)
    ImageView imageSuccess;
    @BindView(R.id.tv_success)
    TextView tvSuccess;
    @BindView(R.id.tv_success_text)
    TextView tvSuccessText;
    @BindView(R.id.tv_back_home)
    TextView tvBackHome;
    private String flag;

    @Override
    protected int setStatusBarColor() {
        return 0;
    }

    @Override
    protected boolean isSettingStatusBarText() {
        return false;
    }

    @Override
    protected int loadLayout() {
        return R.layout.activity_all_success;
    }
    @Override
    protected void initLayout(Bundle savedInstanceState) {
        ButterKnife.bind(this);
        ButterKnife.bind(this);
        //透明状态栏
        StatusBarUtils.Full(this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }
        flag = getIntent().getStringExtra("flag");
        initView();
    }
    /**
    * @method
    * @description 数据实例化
    * @date: 2018/11/7 10:07
    * @author: ljp
    * @return
    */
    private void initView() {
        switch (flag){//0投诉 、 1举报 、2充值 、 3提现 ， 4购买 、 5客服与帮助
            case "0":
                imageSuccess.setImageResource(R.mipmap.complain_success);
                tvSuccess.setText("投诉成功！");
                tvTitle.setText("投诉");
                tvSuccessText.setText(getResources().getText(R.string.report_complain_success));
                break;
            case "1":
                imageSuccess.setImageResource(R.mipmap.report_success);
                tvSuccess.setText("举报成功！");
                tvTitle.setText("举报");
                tvSuccessText.setText(getResources().getText(R.string.report_complain_success));
                break;
            case "2":
                imageSuccess.setImageResource(R.mipmap.recharge_success);
                tvSuccess.setText("充值成功！");
                tvTitle.setText("充值");
                tvSuccessText.setText(getResources().getText(R.string.buy_success));
                break;
            case "3":
                imageSuccess.setImageResource(R.mipmap.withdraw_success);
                tvSuccess.setText("待审核！");
                tvTitle.setText("提现");
                tvSuccessText.setText(getResources().getText(R.string.withdraw_success));
                break;
            case "4":
                imageSuccess.setImageResource(R.mipmap.buy_success);
                tvSuccess.setText("购买成功！");
                tvTitle.setText("购买会员");
                tvSuccessText.setText(getResources().getText(R.string.buy_success));
                break;
            case "5":
                imageSuccess.setImageResource(R.mipmap.complain_success);
                tvSuccess.setText("反馈成功！");
                tvTitle.setText("客服与帮助");
                tvSuccessText.setText(getResources().getText(R.string.report_complain_success));
                break;
        }
    }
    @OnClick({R.id.linear_back, R.id.tv_back_home})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.linear_back:
                if(flag.equals("4")){//购买会员
                    context.startActivity(new Intent(context, MemberCenterActivity.class));
                }else if(flag.equals("2")){
                    context.startActivity(new Intent(context, MyWalletActivity.class));
                }
                finish();
                break;
            case R.id.tv_back_home:
                if(flag.equals("4")){//购买会员
                    context.startActivity(new Intent(context, MemberCenterActivity.class));
                    finish();
                }else if(flag.equals("2")){
                    context.startActivity(new Intent(context, MyWalletActivity.class));
                    finish();
                }else {
                    Intent intent = new Intent(activity, MainActivity.class);
                    intent.putExtra("flag",0);
                    startActivity(intent);
                }
                break;
        }
    }
}
